<style lang="less" scoped>
.panel {
  margin-bottom: 10px;
  &-title {
    display: flex;
    padding: 10px;
    border-bottom: 0.1px solid #eaeaea;
    background: white;

    &__label {
      flex: 1;
      font-size: 16px;
      align-items: center;
    }
  }
  &-content {
    margin-bottom: 10px;
    background: white;

    &__item {
      display: flex;
      padding: 10px 10px 0 10px;
      font-size: 14px;
      &-label {
        color: #666;
        // width: 80px;
      }
      &-value {
        flex: 1;
        padding-left: 15px;
        color: #333;
        word-break: break-all;
      }
    }
  }
}
</style>

<template>
  <div class="panel">
    <!-- title -->
    <div class="panel-title">
      <div class="panel-title__label">基本信息</div>
      <div class="panel-title__right"></div>
    </div>
    <!-- content -->
    <div class="panel-content">
      <div class="panel-content__item">
        <div class="panel-content__item-label">联系电话</div>
        <div class="panel-content__item-value c-primary" @click="makePhoneCall(item.ContactInfo.PhoneNumber)">{{item.ContactInfo.PhoneNumber||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item">
        <div class="panel-content__item-label">邮箱地址</div>
        <div class="panel-content__item-value c-primary" @click="copyText">{{item.ContactInfo.Email||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item" v-for="(item1, index1) in item.ContactInfo.WebSite" :key="index1">
        <div class="panel-content__item-label">官网地址{{index1||'-'}}</div>
        <div class="panel-content__item-value c-primary" @click="copyText">{{item1.Url||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item">
        <div class="panel-content__item-label">公司地址</div>
        <div class="panel-content__item-value c-primary" @click="__getMap__(item.Address)">{{item.Address||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
    </div>
    <!-- content -->
    <div class="panel-content">
      <div class="panel-content__item">
        <div class="panel-content__item-label">英文名称</div>
        <div class="panel-content__item-value">{{item.EnglishName||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item">
        <div class="panel-content__item-label">所属行业</div>
        <div class="panel-content__item-value">{{item.Scope||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item">
        <div class="panel-content__item-label">企业标签</div>
        <div class="panel-content__item-value">{{item.Tag||'-'}}</div>
        <div class="panel-content__item-right"></div>
      </div>
      <div class="panel-content__item">
        <div class="panel-content__item-label">公司简介</div>
        <div class="panel-content__item-value">-</div>
        <div class="panel-content__item-right"></div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      item: {}
    };
  },
  onLoad() {
    try {
      const company = this.$store.getters.companyInfo.Company;
      this.item = company;
    } catch (error) {}
  },
  methods: {
    makePhoneCall(phone) {
      // 拨打电话
      if (!phone) {
        wx.showToast({
          title: '电话无效！',
          icon: 'none',
          mask: true
        });
        return;
      }
      wx.makePhoneCall({
        phoneNumber: phone || '' // 仅为示例，并非真实的电话号码
      });
    },
    copyText(e) {
      // 复制文本内容
      let text = null;
      try {
        text = e.mp._relatedInfo.anchorTargetText;
      } catch (error) {
        wx.showToast({
          title: '复制失败！',
          icon: 'none',
          mask: true
        });
      }

      wx.setClipboardData({
        data: text,
        success(res) {
          wx.getClipboardData({
            success(res) {
              wx.showToast({
                title: '复制成功'
              });
            }
          });
        }
      });
    }
  }
};
</script>
